<?php require_once('Connections/cnn.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "Admin,User,Client";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "error.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>


<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_Recordset1 = "-1";
if (isset($_GET['IdImagen'])) {
  $colname_Recordset1 = $_GET['IdImagen'];
}
mysql_select_db($database_cnn, $cnn);
$query_Recordset1 = sprintf("SELECT * FROM slider WHERE IdImagen = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $cnn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_usuarios = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_usuarios = $_SESSION['MM_Username'];
}
mysql_select_db($database_cnn, $cnn);
$query_usuarios = sprintf("SELECT * FROM usuario WHERE Email = %s", GetSQLValueString($colname_usuarios, "text"));
$usuarios = mysql_query($query_usuarios, $cnn) or die(mysql_error());
$row_usuarios = mysql_fetch_assoc($usuarios);
$totalRows_usuarios = mysql_num_rows($usuarios);
?>
<!doctype html>
<html><!-- InstanceBegin template="/Templates/plantilla.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Ventas</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="css/estilo.css" rel="stylesheet" type="text/css"><!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- InstanceBeginEditable name="1" -->
<!-- Skitter Styles -->
<link href="css/styles.css" type="text/css" media="all" rel="stylesheet" />
<link href="css/skitter.styles.css" type="text/css" media="all" rel="stylesheet" />
<link href="css/menu3.css" rel="stylesheet" type="text/css">
<!-- Skitter JS -->
<script type="text/javascript" language="javascript" src="js/jquery-1.6.3.min.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.animate-colors-min.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.skitter.min.js"></script>
<script type="text/javascript" language="javascript" src="js/menu.js"></script>
<![endif]-->
<!-- InstanceEndEditable -->
</head>


<body>


<div class="container">
  <header>
    <img src="images/banner.png" width="960" height="194" />
      <ul class="menu3">
    <li> <a href="#">Bienvenido/@: <?php echo $row_usuarios['Usuario']; ?></a>
 
        <ul>
          <?php if($_SESSION['MM_UserGroup']=='Admin'){ ?>


            <li><a href="admin/index2.php" class="ele">Administracion del sitio</a></li> <?php } ?>
            <li><a href="<?php echo $logoutAction ?>" class="auvi">Cerrar Sesion</a></li>
        </ul>
    </li>
    
</ul>


  </header>
    <ul class="menu">
            <li><a href="index_r.php">Home</a></li>
            <li><a href="Productos_r.php">Productos</a></li>
            <li><a href="#">Acerca</a></li>
            <li><a href="Contactenos_r.php">Contactanos</a></li>
        </ul>

   <br><br><br><br>
  <!-- InstanceBeginEditable name="2" -->
  
  <!--script del slider -->
  <script type="text/javascript" language="javascript">
    $(document).ready(function() {
      $('.box_skitter_large').css({width: 600, height: 400}).skitter({
        theme: 'clean',
        numbers_align: 'center',
        progressbar: true, 
        dots: true, 
        preview: true
      });
    });
  </script>

  <!-- script del menu -->
   <script type="text/javascript">
            $(document).ready(function() {
                $('.menu').tagdrop({tagPaddingTop: '60px',bgColor: '#B1CCED',bgMoverColor: '#7FB0F0',textColor: '#e0e0e0'});
            });
        </script>
  
    <div id="page">
    <div id="content">
      <div class="border_box">
        <div class="box_skitter box_skitter_large">
          <ul>
            <?php
            $con=mysql_query("select IdImagen from slider");
            while ($row=mysql_fetch_assoc($con)){

              for ($i = $row['IdImagen']; $i <= $row['IdImagen']; $i++){
              $consulta= mysql_query("select Imagen, Descripcion from slider where IdImagen = '$i'");
              $datos = mysql_fetch_assoc($consulta);
              
              $imagen= $datos['Imagen'];
              $descrip= $datos['Descripcion'];
              
              echo "<li>";
                echo " <img src='images/slider/$imagen' class='block'/><div class='label_text'><p>$descrip </p></div>";
        
               
              echo "</li>"; 
              $i++;
              
              
              }
            }
            
              
                     ?>
          
          
          </ul>
        </div>
      </div>
    </div>
  </div>
     <h2>Chat</h2>
                    <br />
                   <!-- mibew button --><a href="/Ventas/admin/chat/client.php?locale=es" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 &amp;&amp; window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open(&#039;/Ventas/admin/chat/client.php?locale=es&amp;url=&#039;+escape(document.location.href)+&#039;&amp;referrer=&#039;+escape(document.referrer), 'mibew', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src="/Ventas/admin/chat/b.php?i=mgreen&amp;lang=es" border="0" width="177" height="61" alt=""/></a><!-- / mibew button -->
  <h1>Categorias</h1>
<div id="sidebar7">
      <center><img src="images/nuevo.jpg" width="210" height="110"  /> </center>
      <a href="#"><h3>Nuevos Productos</h3></a>
    </div>
      <div id="sidebar8">
      <center><img src="images/descuento.jpg" width="210" height="110"  /> </center>
      <a href="#"><h3>Promociones</h3></a>
    </div>

    <div id="sidebar3">
      <center><img src="images/electrodomesticos.jpg" width="230" height="95"  /> </center>
      <a href="#"><h3>Electrodomesticos</h3></a>
    </div>
      <div id="sidebar4">
      <center><img src="images/audio.jpg" width="230" height="95"  /> </center>
      <a href="#"><h3>Audio y video</h3></a>
    </div>
    <div id="sidebar5">
      <center><img src="images/hogar.jpg" width="230" height="95"  /> </center>
      <a href="#"><h3>Hogar</h3></a>
      
    </div>
  

  
  
  <div class="content">
    
    
    
   </div>  

  <footer>
    <h3>Super Gangas</h3>
  </footer>
  <!-- end .container --></div>

</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($usuarios);
?>
